<?php

namespace app\validate;

use think\Validate;

class TrainingValidate extends Validate
{
    protected $rule = [
        'project_id' => 'require|number',
        'title'      => 'require|max:100',
        'content'    => 'require',
        'start_time' => 'require|date',
        'end_time'   => 'require|date',
    ];

    protected $message = [
        'project_id.require' => '项目ID不能为空',
        'project_id.number'  => '项目ID必须是数字',
        'title.require'      => '标题不能为空',
        'title.max'          => '标题不能超过100个字符',
        'content.require'    => '内容不能为空',
        'start_time.require' => '开始时间不能为空',
        'start_time.date'    => '开始时间格式不正确',
        'end_time.require'   => '结束时间不能为空',
        'end_time.date'      => '结束时间格式不正确',
    ];

    protected $scene = [
        'create' => ['project_id', 'title', 'content', 'start_time', 'end_time'],
    ];
}
